#include "pcb.h"
#include "config.h"
#include <stdlib.h>

struct PCB *alloc_PCB(int pid) {
  struct PCB *res = (struct PCB *)malloc(sizeof(struct PCB));
  res->pid = pid;
  res->next = NULL;
  res->priority = get_rand_priority();
  res->cpu_time = 0;
  res->need_time = get_rand_time();
  res->state = WAITING;
  res->time_slice = get_rand_time_slice(res->need_time);
  return res;
}